{extend name="base" /}
{block name="main"}
<style type="text/css">
    .layui-nav-tree .layui-this {
        background-color: #393D49;
        color: #fff;
    }
</style>
<div class="header">
    <div class="main">
        <a class="logo" href="{:url('index/index')}" title="Tpt-Content内容管理系统"><img src="/public/img/logo.png"></a>
        <span></span>
        <div class="nav-user">
            <a class="avatar">
                <img src="{$Think.session.adminhead}">
                <cite>{$tptadmin.adminname}</cite>
                <i>管理员</i>
            </a>
            <div class="nav">

                <a class="xiugai" style="cursor: pointer;"><i class="layui-icon" style="top: 2px; font-size: 24px;padding-right: 6px;">&#xe620;</i>密码修改</a>
                <a class="update_cache" href="javascript:void(0)"><i class="layui-icon">&#xe640;</i>清理缓存</a>
                <a target="_blank" href="/"><i class="layui-icon" style="top: 3px; font-size: 24px;padding-right: 8px;">&#xe609;</i>网站首页</a>
                <a class="logi_logout" href="javascript:void(0)"><i class="layui-icon" style="top: 4px;font-size: 24px;padding-right: 8px;">&#x1006;</i>退出</a>
            </div>
        </div>
    </div>
</div>

<div class="main fly-user-main layui-clear">
    <ul class="layui-nav layui-nav-tree">

        <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;">内容系统</a>
            <dl class="layui-nav-child">

                <dd><a href="{:url('category/index')}" target="main"><i class="layui-icon">&#xe61f;</i>分类管理</a></dd>
                <dd><a href="{:url('content/index')}" target="main"><i class="layui-icon">&#xe63c;</i>内容管理</a></dd>
                <dd><a href="{:url('comment/index')}" target="main"><i class="layui-icon">&#xe63a;</i>评论管理</a></dd>
                <dd><a href="{:url('navtop/index')}" target="main"><i class="layui-icon">&#xe609;</i>导航管理</a></dd>
                <dd><a href="{:url('banner/index')}" target="main"><i class="layui-icon">&#xe60d;</i>图片管理</a></dd>

            </dl>
        </li>

        <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;">会员系统</a>
            <dl class="layui-nav-child">
                <dd><a href="{:url('member/index')}" target="main"><i class="layui-icon">&#xe612;</i>会员管理</a></dd>
                <dd><a href="{:url('point/index')}" target="main"><i class="layui-icon">&#xe641;</i>积分管理</a></dd>
                <dd><a href="{:url('admin/index')}" target="main"><i class="layui-icon">&#xe614;</i>管理修改</a></dd>

            </dl>
        </li>

        <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;">站点管理</a>
            <dl class="layui-nav-child">
                <dd><a href="{:url('config/index')}" target="main"><i class="layui-icon">&#xe62c;</i>网站配置</a></dd>

                <dd><a href="{:url('links/index')}" target="main"><i class="layui-icon">&#xe64e;</i>友情连接</a></dd>

            </dl>
        </li>
    </ul>
</div>

<div class="layui-body iframe-container">
    <iframe class="admin-iframe" id="admin-iframe" name="main" src="{:url('index/home')}"></iframe>
</div>

<div id="xiugais" style="display: none;">
    <form class="layui-form" style="padding: 20px;">
        <input type="hidden" name="adminid" value="1">
        <div class="layui-form-item">
            <input type="password" name="password" required lay-verify="required" placeholder="输入密码" autocomplete="off"
                   class="layui-input">
        </div>
        <div class="layui-form-item">
            <input type="password" name="passwords" required lay-verify="required" placeholder="确认密码" autocomplete="off"
                   class="layui-input">
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" lay-submit="" lay-filter="admin_edit">立即提交</button>
        </div>
    </form>
</div>

<script type="text/javascript">
    layui.use(['form', 'layer', 'element'], function () {
        var form = layui.form,
            layer = layui.layer,
            element = layui.element,
            jq = layui.jquery;

        jq('.left_menu_ul .layui-nav-item').click(function () {
            jq('.left_menu_ul .layui-nav-item').removeClass('layui-this');
            jq(this).addClass('layui-this');
            jq("#iframe-mask").show();
            jq("#admin-iframe").load(function () {
                jq("#iframe-mask").fadeOut(100);
            });
        });

        jq('.update_cache').click(function () {
            loading = layer.load(2, {
                shade: [0.2, '#000']
            });
            jq.getJSON('{:url("index/update")}', function (data) {
                if (data.code == 200) {
                    layer.close(loading);
                    layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                        location.reload();
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
                }
            });
        });

        jq('.logi_logout').click(function () {
            loading = layer.load(2, {
                shade: [0.2, '#000']
            });
            jq.getJSON('{:url("login/logout")}', function (data) {
                if (data.code == 200) {
                    layer.close(loading);
                    layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                        location.reload();
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
                }
            });
        });

        jq('.xiugai').click(function () {
            layer.open({
                type: 1,
                title: '密码修改',
                shadeClose: true,
                area: ['320px', '250px'],
                content: $('#xiugais')
            });
        });

        form.on('submit(admin_edit)', function (data) {
            loading = layer.load(2, {
                shade: [0.2, '#000']
            });
            var param = data.field;
            jq.post('{:url("admin/edit")}', param, function (data) {
                if (data.code == 200) {
                    layer.close(loading);
                    layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                        location.reload();
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
                }
            });
            return false;
        });

    });
</script>
{/block}